jmp SYMBOL_NAME(start_kernel)
-# Stack is 8kB. We leave 100 bytes trailer for fake 'pt_regs'.
-# This is needed so that iopl checks of the saved eflags register
-# work correctly, for example.
ENTRY(stack_start)
- .long SYMBOL_NAME(init_task_union)+8192-100, __KERNEL_DS
+ .long SYMBOL_NAME(init_task_union)+8192, __KERNEL_DS
.org 0x1000
ENTRY(empty_zero_page)
{
struct pt_regs *regs = (struct pt_regs *)&unused;
unsigned int new_io_pl = regs->ebx & 3;
- unsigned int old_io_pl = (regs->eflags >> 12) & 3;
+ unsigned int old_io_pl = current->thread.io_pl;
unsigned int new_hypercall_pl = (regs->ebx >> 2) & 3;
unsigned int old_hypercall_pl = current->thread.hypercall_pl;
/* Maintain OS privileges even if user attempts to relinquish them. */
if ( new_hypercall_pl == 0 )
new_hypercall_pl = 1;
- if ( (new_io_pl == 0) && !(start_info.flags & SIF_PRIVILEGED) )
+ if ( (new_io_pl == 0) && (start_info.flags & SIF_PRIVILEGED) )
new_io_pl = 1;
/* Change our version of the privilege levels. */
- regs->eflags = (regs->eflags & 0xffffcfff) | (old_io_pl << 12);
+ current->thread.io_pl = new_io_pl;
current->thread.hypercall_pl = new_hypercall_pl;
/* Force the change at ring 0. */
struct task_struct * p, struct pt_regs * regs)
{
struct pt_regs * childregs;
+ unsigned long eflags;
childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p)) - 1;
struct_cpy(childregs, regs);
unlazy_fpu(current);
struct_cpy(&p->thread.i387, ¤t->thread.i387);
+
+ __asm__ __volatile__ ( "pushfl; popl %0" : "=r" (eflags) : );
+ p->thread.io_pl = (eflags >> 12) & 3;
+
/* We're careful with hypercall privileges. Don't allow inheritance. */
p->thread.hypercall_pl = 1;
queue_multicall2(__HYPERVISOR_stack_switch, __KERNEL_DS, next->esp0);
/* Next call will silently fail if we are a non-privileged guest OS. */
queue_multicall2(__HYPERVISOR_set_priv_levels,
- ((((struct pt_regs *)next->esp0)-1)->eflags>>12)&3,
- next->hypercall_pl);
+ next->io_pl, next->hypercall_pl);
/* EXECUTE ALL TASK SWITCH XEN SYSCALLS AT THIS POINT. */
execute_multicall_list();
void __init setup_arch(char **cmdline_p)
{
- struct pt_regs *regs = ((struct pt_regs *)current->thread.esp0) - 1;
unsigned long start_pfn, max_pfn, max_low_pfn;
unsigned long bootmap_size;
unsigned long i;
paging_init();
- regs->eflags &= ~(3<<12);
+ current->thread.hypercall_pl = 1;
if ( start_info.flags & SIF_PRIVILEGED ) {
+ current->thread.io_pl = 1;
/* We are privileged guest os - should have IO privileges. */
if( HYPERVISOR_set_priv_levels(1, 1) )
panic("Unable to obtain IOPL, despite being SIF_PRIVILEGED");
- regs->eflags |= 1<<12;
}
if(start_info.flags & SIF_CONSOLE)
unsigned long esp;
unsigned long fs;
unsigned long gs;
- unsigned int hypercall_pl;
+ unsigned int io_pl, hypercall_pl;
/* Hardware debugging registers */
unsigned long debugreg[8]; /* %%db0-7 debug registers */
/* fault info */
};
#define INIT_THREAD { sizeof(init_stack) + (long) &init_stack, \
- 0, 0, 0, 0, 1, {0}, 0, 0, 0, {0}, 0, 0, 0, 0, 0 }
+ 0, 0, 0, 0, 0, 0, {0}, 0, 0, 0, {0}, 0, 0, 0, 0, 0 }
#define INIT_TSS { \
0,0, /* back_link, __blh */ \